package pro.spring.tool;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;


public class SwitchInterceptor extends HandlerInterceptorAdapter{
	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		HttpSession session=request.getSession();
		if(session.getAttribute("switch")=="0"){
			request.getRequestDispatcher("../check/close.html").forward(request,response);
			System.out.println("===网站关闭拦截下来！！！！===");
			return false;
		}
		return true;
	}
}